package top.jolyoulu.modules.apiversionmodule.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import top.jolyoulu.modules.apiversionmodule.apiverion.ApiHandlerMapping;


/**
 * @Author: JolyouLu
 * @Date: 2023/1/20 15:49
 * @Description
 */
@Configuration
@EnableConfigurationProperties(value = {ApiVersionProperties.class})
public class ApiVersionConfig implements WebMvcRegistrations {

    @Autowired
    private ApiVersionProperties apiVersionProperties;

    @Override
    public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
        return new ApiHandlerMapping(apiVersionProperties.getRequestHandle());
    }
}
